package com.jxdinfo.hussar.cloud.module.example.dljc.basket.controller;

import com.jxdinfo.hussar.cloud.module.example.dljc.basket.vo.BasketSearchVO;
import com.jxdinfo.hussar.cloud.module.example.dljc.basket.vo.BasketVO;
import com.jxdinfo.hussar.cloud.module.example.dljc.basketpoint.vo.BasketPointSearchVO;
import com.jxdinfo.hussar.cloud.module.example.dljc.basketpoint.vo.BasketPointVO;
import com.jxdinfo.hussar.platform.core.base.apiresult.ApiResponse;
import com.jxdinfo.hussar.support.audit.core.enums.AuditEventGrade;
import com.jxdinfo.hussar.support.audit.core.enums.AuditEventType;
import com.jxdinfo.hussar.support.mp.base.controller.HussarBaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jxdinfo.hussar.support.audit.core.annotations.AuditLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jxdinfo.hussar.cloud.module.example.dljc.basket.model.Basket;
import com.jxdinfo.hussar.cloud.module.example.dljc.basket.service.BasketService;
import com.jxdinfo.hussar.cloud.module.example.dljc.basket.model.Basket;
import com.jxdinfo.hussar.cloud.module.example.dljc.basket.service.BasketService;

import java.util.List;

/**
 * 吊篮表控制器
 */
@RestController(value = "dljc.basket.BasketController")
@AuditLog(moduleName = "吊篮表")
@RequestMapping(value = "/dljc/basket")
public class BasketController extends HussarBaseController<Basket, BasketService> {

    private static final Logger logger = LoggerFactory.getLogger(BasketController.class);

    @Autowired
    private BasketService basketService;

    /**
     * 条件查询
     *
     * @param basketSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮表", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.INSERT)
    @PostMapping("findByList")
    public ApiResponse<List<BasketVO>> findByList(@RequestBody BasketSearchVO basketSearchVO) {
        //todo 没有获取项目编号工具类

        return basketService.findByList(basketSearchVO);
    }

    /**
     * 根据id查询吊篮
     *
     * @param basketSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮表", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.INSERT)
    @PostMapping("findOne")
    public ApiResponse<BasketVO> findOne(@RequestBody BasketSearchVO basketSearchVO) {
        //todo 没有获取项目编号工具类

        return basketService.findOne(basketSearchVO);
    }

    /**
     * 新建吊篮
     *
     * @param basketSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮表", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.INSERT)
    @PostMapping("add")
    public ApiResponse<String> add(@RequestBody BasketSearchVO basketSearchVO) {
        //todo 没有获取项目编号工具类

        return basketService.add(basketSearchVO);
    }

    /**
     * 修改吊篮
     *
     * @param basketSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮表", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.INSERT)
    @PostMapping("update")
    public ApiResponse<String> update(@RequestBody BasketSearchVO basketSearchVO) {
        //todo 没有获取项目编号工具类

        return basketService.updateBasket(basketSearchVO);
    }

    /**
     * 删除吊篮
     *
     * @param basketSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮表", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.INSERT)
    @PostMapping("deleteById")
    public ApiResponse<String> deleteById(@RequestBody BasketSearchVO basketSearchVO) {
        //todo 没有获取项目编号工具类

        return basketService.deleteById(basketSearchVO);
    }
}
